package behaviors.particle {
	import org.flixel.*
	public class FlyStraightBehavior extends ParticleBehavior{
		public var speed:int;
		public function FlyStraightBehavior(speed:int) : void {
			this.speed = speed;
			super();
		}

		override public function fire(facing:uint, p:Particle, explodeBehavior:ExplodeBehavior) : void{
			p.velocity.x = 0;
			p.velocity.y = 0;
			if (facing == FlxSprite.RIGHT) {
				p.velocity.x = speed;
			} else if (facing == FlxSprite.LEFT) {
				p.velocity.x = -speed;
			} else if (facing == FlxSprite.UP) {
				p.velocity.y = -speed;
			} else if (facing == FlxSprite.DOWN) {
				p.velocity.y = speed;
			}
			p.setExplodeBehavior(explodeBehavior);
			(FlxG.state as GameState).spawnParticleTimer(1.25, p.explode);
			// Subclasses generate particles and pass them the particle behavior
		}
	}
}
